#ifndef Cond_h
#define Cond_h
#include"Mutex.hpp"
namespace zgw
{
    class Cond
    {
    public:
        Cond()
        {
            pthread_cond_init(&_cond,nullptr);

        }
        void Wait(zgw::Mymutex&mu)
        {
            pthread_cond_wait(&_cond,mu.Getmutex());
        }

        void Siganl()
        {
            pthread_cond_signal(&_cond);
        }

        void Broadcast()
        {
            pthread_cond_broadcast(&_cond);
        }
        ~Cond()
        {
            pthread_cond_destroy(&_cond);
        };
    private:
        pthread_cond_t _cond;
    };
    
}
#endif